package com.ctsi.offlinesupport.app.rest;

import com.ctsi.commons.util.UtilValidate;
import com.ctsi.framework.common.response.UnifiedResponse;
import com.ctsi.system.service.api.DictionaryServiceProxy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class VersonController {

    @Autowired
    private DictionaryServiceProxy dictionaryServiceProxy;

    @PostMapping(value = "/support-app/version")
    public UnifiedResponse<String> version(){

       String version = dictionaryServiceProxy.getDictValue("app-version","version");
        if (UtilValidate.isEmpty(version)) {
            return UnifiedResponse.ok("3.0.2");
        } else {
            return UnifiedResponse.ok(version);
        }

    }

}
